<%@ page language="java" pageEncoding="UTF-8"%><%@ include
	file="/WEB-INF/commons/taglibs.jsp"%>
<script type="text/javascript">
$(function(){
	function showMsg($item, msgType, msg, timeout){
		var classType='ui-state-highlight';
		if(msgType=='error'){
			classType='ui-state-error';
		}
		$item.addClass(classType);
		$item.html("<span class='ui-icon ui-icon-info' style='float: left; margin-right: .3em;'></span>"+msg);
		setTimeout(function(){$item.html('').removeClass(classType);},timeout);
	}
	function mkFridsWith(userName){
		$.ajax({
			url: '/user/ajax/mkFrid/With/'+userName,
			type: 'POST',
			timeout: 10000,
			error: function(){showMsg($('#message'),'error','添加好友失败!',3000);},
			success: function(response){if(response.search('ERROR')!=-1){
				showMsg($('#message'),'error',response,3000);
			}else{
				showMsg($('#message'),'info','添加好友成功!',3000);
				setTimeout(function(){window.location.href='/myFlows';},3000);
			}}
		});
	}
	$('#mkFridsWith').button().click(function(){mkFridsWith('${it.user}')});
});
</script>
<!-- Flow展示区 -->
<table>
	<tr>
		<td><%@ include file="/WEB-INF/commons/flows.jsp"%></td>
		<td>
		<div id="flowsNav">
		<div class="navContainer">
		<div class="btnContainer">
		<button id="mkFridsWith">加为好友</button>
		</div>
		<br />
		<p class="title">流程包列表</p>
		<ul>
			<c:forEach var="e" items="${it.packs}">
				<li>
				<p class="name"><a
					href="<c:url value="/user/${it.userName}/${e.id}"/>">${e.name}</a></p>
				<p class="info"><fmt:formatDate value="${e.crtDate}"
					pattern="yyyy-MM-dd HH:mm:ss" /></p>
				</li>
			</c:forEach>
		</ul>
		</div>
		</div>
		</td>
	</tr>
</table>